package com.fansaikj.erp.domain;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;

import com.fansaikj.erp.domain.comtactCompany.CustomerCompany;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(name = "费用申请")
@Table(name = "erp_expense_apply")
@Entity
@Data
public class ExpenseApply extends BaseModel {

    @EruptField(
            views = @View(
                    title = "主键ID", show = false
            ),
            edit = @Edit(
                    title = "主键ID",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "费用单号"
            ),
            edit = @Edit(
                    title = "费用单号",
                    type = EditType.INPUT, search = @Search, notNull = true,
                    inputType = @InputType
            )
    )
    private String applyNo;

    @EruptField(
            views = @View(
                    title = "结算单位",
                    column = "name"
            ),
            edit = @Edit(
                    title = "结算单位",
                    type = EditType.REFERENCE_TABLE, search = @Search, notNull = true,
                    referenceTableType = @ReferenceTableType(id = "id", label = "name")
            )
    )
    @ManyToOne
    private SettlementCompany settlementCompany;

    @EruptField(
            views = @View(
                    title = "费用日期"
            ),
            edit = @Edit(
                    title = "费用日期",
                    type = EditType.DATE, search = @Search(vague = true), notNull = true,
                    dateType = @DateType
            )
    )
    private Date expenseDate;

    @EruptField(
            views = @View(
                    title = "往来客户",
                    column = "name"
            ),
            edit = @Edit(
                    title = "往来客户",
                    type = EditType.REFERENCE_TABLE, search = @Search, notNull = true,
                    referenceTableType = @ReferenceTableType(id = "id", label = "name")
            )
    )
    @ManyToOne
    private CustomerCompany customer;

    @EruptField(
            views = @View(
                    title = "付款账户",
                    column = "accountName"
            ),
            edit = @Edit(
                    title = "付款账户",
                    type = EditType.REFERENCE_TABLE, search = @Search,
                    referenceTableType = @ReferenceTableType(id = "id", label = "accountName")
            )
    )
    @ManyToOne
    private CapitalAccount payAccount;

    @EruptField(
            views = @View(
                    title = "关联出库单"
            ),
            edit = @Edit(
                    title = "关联出库单",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String salesOrderId;

    @EruptField(
            views = {
                    @View(title = "费用名称", column = "chargeName"),
                    @View(title = "收支方向", column = "paymentDirectionType"),
            },
            edit = @Edit(
                    title = "费用名称",
                    type = EditType.REFERENCE_TABLE, search = @Search,
                    referenceTableType = @ReferenceTableType(id = "id", label = "chargeName")
            )
    )
    @ManyToOne
    private SettingCharge settingCharge;

    @EruptField(
            views = @View(
                    title = "应收费用"
            ),
            edit = @Edit(
                    title = "应收费用",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String receivable;

    @EruptField(
            views = @View(
                    title = "应付费用"
            ),
            edit = @Edit(
                    title = "应付费用",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String payable;

    @EruptField(
            views = @View(
                    title = "收款信息（开户人、账号、开户行）"
            ),
            edit = @Edit(
                    title = "收款信息（开户人、账号、开户行）",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String paymentInfo;

    @EruptField(
            views = @View(
                    title = "货物信息"
            ),
            edit = @Edit(
                    title = "货物信息",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String goodsInfo;

    @EruptField(
            views = @View(
                    title = "装货位置"
            ),
            edit = @Edit(
                    title = "装货位置",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String loadingLocation;

    @EruptField(
            views = @View(
                    title = "卸货位置"
            ),
            edit = @Edit(
                    title = "卸货位置",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String unloadingLocation;

    @EruptField(
            views = @View(
                    title = "用车类型"
            ),
            edit = @Edit(
                    title = "用车类型",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String useCarType;

    @EruptField(
            views = @View(
                    title = "装货吨位"
            ),
            edit = @Edit(
                    title = "装货吨位",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String loadingTonnage;

    @EruptField(
            views = @View(
                    title = "装货仓库（几装几卸）"
            ),
            edit = @Edit(
                    title = "装货仓库（几装几卸）",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String loadingWarehouse;

    @EruptField(
            views = @View(
                    title = "运输公司"
            ),
            edit = @Edit(
                    title = "运输公司",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String transCompanyId;

    @EruptField(
            views = @View(
                    title = "运费含税金额"
            ),
            edit = @Edit(
                    title = "运费含税金额",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String freightTaxAmount;

    @EruptField(
            views = @View(
                    title = "是否已提交"
            ),
            edit = @Edit(
                    title = "是否已提交",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String isSubmit;

    @EruptField(
            views = @View(
                    title = "流程进度"
            ),
            edit = @Edit(
                    title = "流程进度",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String processNode;

    @EruptField(
            views = @View(
                    title = "审批状态"
            ),
            edit = @Edit(
                    title = "审批状态",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String approveStatus;

    @EruptField(
            views = @View(
                    title = "当前审批人"
            ),
            edit = @Edit(
                    title = "当前审批人",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String currentApprover;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建时间", show = false
            ),
            edit = @Edit(
                    title = "创建时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "修改人", show = false
            ),
            edit = @Edit(
                    title = "修改人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "修改时间", show = false
            ),
            edit = @Edit(
                    title = "修改时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}